﻿using System.ComponentModel;
using Loki.Commands;
using Loki.Utils;

namespace Loki.UI
{
    public class CommandViewModel : ViewModelBase
    {
        #region Name

        private static PropertyChangedEventArgs _NameChangedArgs = ObservableHelper.CreateChangedArgs<CommandViewModel>(x => x.Name);

        private static PropertyChangingEventArgs _NameChangingArgs = ObservableHelper.CreateChangingArgs<CommandViewModel>(x => x.Name);

        private string _Name;

        public string Name
        {
            get
            {
                return _Name;
            }

            set
            {
                if (value != _Name)
                {
                    NotifyChanging(_NameChangingArgs);
                    _Name = value;
                    NotifyChanged(_NameChangedArgs);
                }
            }
        }

        #endregion Name

        #region Command

        private static PropertyChangedEventArgs _CommandChangedArgs = ObservableHelper.CreateChangedArgs<CommandViewModel>(x => x.Command);

        private static PropertyChangingEventArgs _CommandChangingArgs = ObservableHelper.CreateChangingArgs<CommandViewModel>(x => x.Command);

        private ICommand _Command;

        public ICommand Command
        {
            get
            {
                return _Command;
            }

            set
            {
                if (value != _Command)
                {
                    NotifyChanging(_CommandChangingArgs);
                    _Command = value;
                    NotifyChanged(_CommandChangedArgs);
                }
            }
        }

        #endregion Command
    }
}